<?php 
session_start();
if(! isset($_SESSION['mobile'])){
	echo "<script>window.location.href='../view/accountPassword_login.v.html';</script>";
	exit;
}
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<title>天天果园翻版</title>
	<style>
		body{
			margin :0px;
			padding:0px; 
		}

		@media screen and (min-device-width:321px){
			header{
				background:red;
			}		

		}
		ul{
			margin: 0px;
			padding: 0px;
			list-style: none;
		}
	</style>
	<script src="./js/jquery-3.2.1.min.js"></script>
	<link rel="stylesheet" href="./css/order.css" />
</head>

<body>
	<header id = "">

	</header>
	<section id = "header_search_box">
		<a href="javascript:history.back();" id = "header_search_index"></a>
		<span id ="span_myOrchard">订单确认</span>
	</section>
<form action="../api/shopCartApi.php?act=pushOrder" method="post">
    <section class="m-component-order" id="m-order">
        <ul class="list-unstyled m-order-content">
            <li>
                <div class="m-order-item">
                    <input type="hidden" id="address_id" value="8126265">
                    <a href="" class="m-order-address">
                        黄星民 13631785319
                        <span class="orange">[学校]</span>
                        <span class="orange"></span>
                        <p>上海上海市浦东新区(外环线内)具体你猜</p>
                        <img src="./images/m_user_right_arrow.gif" style="float: right;margin: -28px -14px;">
                    </a>
                </div>
                <div class="m-order-item">
                    <a href="" id="ordertime">
                        <img src="./images/m_user_right_arrow.gif" style="float: right;margin: 4px -14px;">
                        <span class="pull-right">09-24|周日 09:00-18:00</span>
                        配送时间

                    </a>
                </div>
<!--                 <div class="modal fade modal-order modal-ordertime" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-sm">
                        <div class="modal-content">
                            <h4>配送时间<span class="pull-right m-dialog-close"></span></h4>
                            <table class="table table-condensed text-center">
                                <thead>
                                    <tr>
                                        <td><b>时间段</b></td>
                                        <td>09:00-18:00</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    <td>09-24|周日</td>
                                    <td class="s_td" timekey="0918" timevalue="09:00-18:00">
                                        <div class="input-group text-center">
                                            <input type="radio" id="ordertime1" name="ordertime">
                                            <label for="ordertime1" class="glyphicon fdayicon fdayicon-delivery"></label>
                                        </div>    
                                    </td>
                                    <tr class="s_tr" datakey="20170925" datavalue="09-25|周一">
                                        <td>09-25|周一</td>
                                        <td class="s_td" timekey="0918" timevalue="09:00-18:00">
                                            <div class="input-group text-center">
                                                <input type="radio" id="ordertime2" name="ordertime">
                                                <label for="ordertime2" class="glyphicon fdayicon fdayicon-delivery"></label>
                                            </div>    
                                        </td>
                                        <tr class="s_tr" datakey="20170926" datavalue="09-26|周二">
                                            <td>09-26|周二</td>
                                            <td class="s_td" timekey="0918" timevalue="09:00-18:00">
                                                <div class="input-group text-center">
                                                    <input type="radio" id="ordertime3" name="ordertime">
                                                    <label for="ordertime3" class="glyphicon fdayicon fdayicon-delivery"></label>
                                                </div>    
                                            </td>
                                                <tr class="s_tr" datakey="20170927" datavalue="09-27|周三">
                                            <td>09-27|周三</td>
                                            <td class="s_td" timekey="0918" timevalue="09:00-18:00">
                                                <div class="input-group text-center">
                                                    <input type="radio" id="ordertime4" name="ordertime">
                                                    <label for="ordertime4" class="glyphicon fdayicon fdayicon-delivery"></label>
                                                </div>    
                                            </td>
                                                <tr class="s_tr" datakey="20170928" datavalue="09-28|周四">
                                            <td>09-28|周四</td>
                                            <td class="s_td" timekey="0918" timevalue="09:00-18:00">
                                                <div class="input-group text-center">
                                                    <input type="radio" id="ordertime5" name="ordertime">
                                                    <label for="ordertime5" class="glyphicon fdayicon fdayicon-delivery"></label>
                                                </div>    
                                            </td>
                                </tbody>
                            </table>          
                        </div>
                    </div>
                </div> -->
            </li>
            <li>
                <div class="m-order-item">
                    <a href="" id="orderpay">
                        <img src="./images/m_user_right_arrow.gif" style="float: right;margin: 4px -14px;">
                        <span class="pull-right">在线支付</span>
                        支付方式
                    </a>
                </div>
<!--                 <div class="modal fade modal-order modal-orderpay" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
                    <div class="modal-dialog modal-sm">
                        <div class="modal-content ">
                            <h4>支付方式<span class="pull-right m-dialog-close"></span></h4>
                            <h5>在线支付</h5>
                            <ul class="list-unstyled modal-orderpay-list">
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="1">
                                    <input type="hidden" class="pay_id" value="0">
                                    <input type="hidden" class="pay_name" value="在线支付">
                                    <input type="hidden" class="payment_name" value="在线支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay1">
                                    <label for="radiopay1">在线支付</label>
                                </li>
                            </ul>
                            <h5>线下支付</h5>
                            <ul class="list-unstyled modal-orderpay-list">
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="1">
                                    <input type="hidden" class="pay_name" value="货到付现金">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay2">
                                    <label for="radiopay2"><img src="https://imgjd4.fruitday.com/assets/images/bank/app/4_1.png" style="height:20px;margin-right:5px;">货到付现金</label>
                                </li>
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="2">
                                    <input type="hidden" class="pay_name" value="货到刷银行卡">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay3">
                                    <label for="radiopay3"><img src="https://imgjd3.fruitday.com/assets/images/bank/app/4_2.png" style="height:20px;margin-right:5px;">货到刷银行卡</label>
                                </li>
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="7">
                                    <input type="hidden" class="pay_name" value="红色储值卡支付">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay4">
                                    <label for="radiopay4"><img src="https://imgjd2.fruitday.com/assets/images/bank/app/4_7.png" style="height:20px;margin-right:5px;">红色储值卡支付</label>
                                </li>
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="8">
                                    <input type="hidden" class="pay_name" value="金色储值卡支付">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay5">
                                    <label for="radiopay5"><img src="https://imgjd2.fruitday.com/assets/images/bank/app/4_8.png" style="height:20px;margin-right:5px;">金色储值卡支付</label>
                                </li>
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="9">
                                    <input type="hidden" class="pay_name" value="果实卡支付">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay6">
                                    <label for="radiopay6"><img src="https://imgjd4.fruitday.com/assets/images/bank/app/4_9.png" style="height:20px;margin-right:5px;">果实卡支付</label>
                                </li>
                                <li class="clearfix">
                                    <input type="hidden" class="pay_parent_id" value="4">
                                    <input type="hidden" class="pay_id" value="11">
                                    <input type="hidden" class="pay_name" value="通用券/代金券支付">
                                    <input type="hidden" class="payment_name" value="线下支付">
                                    <input type="radio" class="show" name="radiopay" id="radiopay7">
                                    <label for="radiopay7"><img src="https://imgjd4.fruitday.com/assets/images/bank/app/4_11.png" style="height:20px;margin-right:5px;">通用券/代金券支付</label>
                                </li>
                            </ul>
                        </div>                        
                    </div>
                </div> -->
                <div class="m-order-item">
                    <a href="/order/couponList//0.00">
                        <img src="./images/m_user_right_arrow.gif" style="float: right;margin: 14px -14px;">
                        <span class="pull-right">请选择</span>
                        使用优惠券(0)
                    </a>
                </div>
                <div class="m-order-item">使用积分(最多可抵扣¥<font id="order_jf_limit">0.00</font>元)
                    <div class="onoffswitch">
                        <input type="checkbox" name="onoffswitch" class="onoffswitch-checkbox" id="myonoffswitch" value="0">
                        <label class="onoffswitch-label" for="myonoffswitch">
                            <div class="onoffswitch-inner">
                                <div class="onoffswitch-active">ON</div>
                                <div class="onoffswitch-inactive">OFF</div>
                            </div>
                            <div class="onoffswitch-switch"></div>
                        </label>
                    </div>
<!--                     <div class="m-order-integral">
                        <p><span class="pull-right"><input id="order_use_jf" type="number" orderusejf="0.00" value="0.00" class="form-control input-sm m-order-int"> 元</span>使用整数金额</p>
                    </div> -->
                </div>                
            </li>

            <li id="fp_li">
                    <div class="m-order-item">是否开发票
                        <input type="hidden" id="fp" value="">
                        <div class="onoffswitch">
                            <input type="checkbox" name="onoffswitch2" class="onoffswitch-checkbox" id="myonoffswitch2" value="0">
                            <label class="onoffswitch-label" for="myonoffswitch2">
                                <div class="onoffswitch-inner">
                                    <div class="onoffswitch-active">ON</div>
                                    <div class="onoffswitch-inactive">OFF</div>
                                </div>
                                <div class="onoffswitch-switch"></div>
                            </label>
                        </div>
<!--                         <div class="m-order-item m-order-integral" id="integral-fp">
                            <a href="/order/orderInvoice"><span class="pull-right"> 请选择</span>发票信息</a>
                        </div> -->
                    </div>
                   
                </li>
                <li>
                <div class="m-order-item">
                    <div class="clearfix m-order-prolist-tips">
                        <img src="./images/m_user_right_arrow.gif" style="float: right;margin: 6px 8px;">
                        商品清单
                    </div>
                    <div class="m-cartlist" style="display: block;">
                        
                            <ul id="goods_list" class="list-unstyled">
    <!--                             <li>
                                    <a href="/detail/index/24146">
                                        <img class="lazy pull-left" alt="" src="./images/1-100x100-103-8UAUAW81.jpg" style="display: block;">
                                        <div class="m-cartlist-info">
                                            <h3>沙地红蜜薯</h3>
                                            <h4>2斤/份</h4>
                                            <h5>￥15.80</h5>                           
                                        </div>
                                    </a>
                                    <span class="m-cartlist-nums">x 1</span>
                                </li>  -->                                
                            </ul>
                                
                    </div>
                </div>
            </li>
            <li>
                <div class="m-order-item">
                    <span class="pull-right orange" id="goods_amount" money=""></span>商品总价
                </div>
                <div class="m-order-item">
                    <span class="pull-right orange" id="method_money" money="">￥0.00</span>运费
                </div>
                <div class="m-order-item">
                    <span class="pull-right" id="pmt_goods" money="0">￥0</span>商品减免
                </div>
                <div class="m-order-item">
                    <span class="pull-right" id="use_jf_money" money="0.00">￥<font>0.00</font></span>积分抵扣
                </div>
                <div class="m-order-item">
                    <span class="pull-right" id="card_money" money="0.00">￥0.00</span>优惠券抵扣
                </div>
                <div class="m-order-item">
                    <span class="pull-right" id="pay_discount" money="0.00">￥0.00</span>其他抵扣
                </div>
            </li>
        </ul>
    </section>
	<footer id="shoppingCart_footer">
	    <div id="footer_left">
	    	<span class="orange" id="totalMoney" money="79.00"></span>
	    </div>
	    <button type="submit" id="footer_right">
	    	提交订单
		</button>
	</footer>
</form>    
	<script>
        function initShopCart(){
            $.get('../api/shopCartApi.php',{'act':'initShopCart'},function(data){
                // alert(data.data)
                if(data.code==100){
                    alert(data.msg)
                    window.location.href="./quick_login.v.php"
                }
                if(data.code==105){
                    var jsonRows=data.data
                    // alert(data.msg)
                    // alert(jsonRows)
                    makeLi(jsonRows)
                }
            },'json')               
        }
        $(initShopCart)
        function makeLi(arr){
            var tab=''
            var money=0
            for(var i in arr){
                var row=arr[i]
                money+=parseFloat(row.price) * parseInt(row.num)
                var goodname=""
                if(row.goodname.length>11){
                    goodname=row.goodname.substr(0,11)+"..."
                }
                tab+='<li><a id="'+row.goodid+'" href="details.v.php?id='+row.goodid+'">'+row.img+'<div class="m-cartlist-info"><h3>'+goodname+'</h3><h4>'+row.nums+''+row.pcs+'</h4><h5>￥'+row.price+'</h5></div></a><span class="m-cartlist-nums">x '+row.num+'</span><input type="hidden" id="'+row.goodid+'" name="'+row.goodid+'" value='+row.goodid+'></li> '
            }
            $("#goods_amount").html('￥'+parseFloat(money).toFixed(2))
            var totalMoney = parseFloat(money)
            $("#totalMoney").html('￥'+parseFloat(totalMoney).toFixed(2))
            $("#goods_list").html(tab)
            $("#goods_list li a img").addClass("lazy pull_left")
            $("#goods_list li a img").css("display","block")
            // $("#m_cartlist").css("display","block")
            // $("#m_carttips").css("display","block")
            // $("#shoppingCart_footer").css("display","block")
            // $("#m_noGoods").css("display","none")
        }		
	</script>
</body>
</html>